package com.ray.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
// @RequestMapping("/parent")
// 如果加@RequestMapping，则下面的url变为/parent/hello
public class RestFullController

{

    /**
     * restFull风格  http://localhost:8080/helloParams/ray  形式
     * @param name
     * @param model
     * @return
     */
    @RequestMapping("/helloRest/{name}")
    String getHelloByRestFull(@PathVariable String name, Model model)
    {
        model.addAttribute("msg", "Hello Annotation! " + name);
        return "hello";
    }

}
